<extend name="Base/common"/>
<block name="header">
{:hook('mobileTopNav',array('title'=>$meta_title))}
</block>

<block name="body">
  
  <div class="text-warning">
    推广二维码，关注就赚钱！
    <div class="pull-right">每人返 <span class="text-danger">{:C('UNION_SUBSCRIBE_CASHBACK')}</span> 元</div>
  </div>
  
  <include file="Union/head" />
  
  <!-- 统计概况 -->
  <div class="union-info">
    <ul class="flex-box">
      <li>
        <h4>本月关注人数</h4>
        <p>{$data.this_month|default=0}</p>
      </li>
      <li>
        <h4>上月关注人数</h4>
        <p>{$data.last_month|default=0}</p>
      </li>
    </ul>
    <ul class="flex-box">
      <li>
        <h4>总关注数</h4>
        <p>{$data.total|default=0}</p>
      </li>
      <li>
        <a href="#qrCode" class="qrcode-link">
          <h4>推广二维码</h4>
          <img src="__IMG__/qrcode-demo.png" width="24">
        </a>
      </li>
    </ul>
  </div>
  <div class="union-info">
    <ul class="flex-box">
      <li>
        <h4>一级代理</h4>
        <p><a href="{:U('unionerlist' ,array('type'=>1))}" >{$counts.one}</a></p>
      </li>
       <if condition='C("DIS_CLASS") gt 1'>
      <li>
        <h4>二级代理</h4>
        <p><a href="{:U('unionerlist' ,array('type'=>2))}" >{$counts.two}</a></p>
      </li>
      </if>
    </ul>
    <ul class="flex-box">
    <if condition='C("DIS_CLASS") gt 2'>
      <li>
        <h4>三级代理</h4>
        <p><a href="{:U('unionerlist' ,array('type'=>3))}" >{$counts.three}</a></p>
      </li>
      <li>
      </li>
      </if>
    </ul>
  </div>
  <!-- 图表 -->
  <div class="union-chart">
    <div class="chart-title-pos">关注趋势</div>
    <div class="chart-body" id="Z_charts">
      <div class="waiting"><img src="__IMG__/loading.gif"> 正在加载图表插件...</div>
    </div>
  </div>
  
  <!-- 二维码 -->
  <div id="qrCode" class="modal">
    <header class="bar bar-nav">
      <a class="icon icon-close pull-right" href="#qrCode"></a>
      <h1 class="title">推广二维码</h1>
    </header>
    <div class="content">
      <div class="text-warning">
        推广二维码，扫码关注就能赚钱哦！
      </div>
      <p class="qrcode-showbox">
        <img src="__ROOT__/Uploads/QRcode/WechatQrcode/{:md5($data_union['qrcode_url'])}.png">
      </p>
    </div>
  </div>
  
  <!-- 未开通提示 -->
  <if condition="!$data_union">
    <div class="modal active">
      <header class="bar bar-nav">
        <h1 class="title">推广联盟</h1>
      </header>
      <div class="union-msg">
        <p class="hd"><i class="icon icon-info"></i> 推广二维码就能赚钱，还犹豫什么呢？</p>
        <p class="bd">
          <a href="javascript:;" class="btn btn-positive Z_open_union">立即开通</a>
          <!--&nbsp;
          <a href="javascript:;" class="btn">推广说明</a-->
        </p>
      </div>
    </div>
  </if>
    
</block>
<block name="script">
  <script>
    seajs.use(['shop','union'], function(shop, union){
     shop.statChart('Z_charts', {labels: {:json_encode($data['labels'])}, datas: {:json_encode($data['datas'])}});
     union.open();
  });
  </script>
</block>